/*
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-10-11 13:32:23
 * @LastEditors: 李小晴 2689279066@qq.com
 * @LastEditTime: 2023-09-06 09:17:15
 * @FilePath: \grazlink20\uc_sys\src\api\cs\class\index.ts
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved.
 */
import { useAxios } from '@/hooks/web/useAxios'
import type { TableData } from './types'
const request = useAxios()
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 分类列表
export const adminCsClassListApi = (data: any) => {
  return request.post({
    // url: 'index.php/api/common',
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsClassList',
      data: data
    }
  })
}

// 分类修改
export const adminCsClassEditApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsClassEdit',
      data: data
    }
  })
}

// 分类新增
export const adminCsClassAddApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsClassAdd',
      data: data
    }
  })
}

// 分类删除
export const adminCsClassDelApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsClassDel',
      data: data
    }
  })
}

// 分类批量删除
export const adminCsClassBatchDelApi = (data: { ids: string }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsClassBatchDel',
      data: data
    }
  })
}
